<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>网店托管</title>
    <style type="text/css">
        * {
            padding: 0;
            margin: 0;
        }
        #content {
            width: 100%;
            height: 5071px;
            background: url(../images/message.jpg) no-repeat;
            background-size: 100% 100%;
            display: flex;
            align-items: center;
            position: relative;
        }
        form {
            width: 94%;
            height: 20.25rem;
            background-color: white;
            bottom: 1.875rem;
            position: absolute;
            left: 50%;
            bottom: 167px;
            margin-left: -47%;
        }
        #content > form > span {
            display: block;
            font-size: 1.5rem;
            text-align: center;
            margin-top: 25px;
        }
        #form_div {
            width: 100%;
            display: flex;
        }
        #form_div > div {
            flex: 1;
            padding-left: 7%;
            margin-top: 50px;
        }
        input {
            width: 85%;
            outline: none;
            background-color: #d5dade;
            border: #d5dade;
        }
        #form_div span {
            display: block;
        }
        #form_div input {
            height: 20px;
        }
        #form_xq {
            margin-top: 10px;
            padding-left: 7%;
        }
        #form_xq > input {
            width: 93%;
            height: 40px;
        }
        span {
            font-weight: bold;
        }
        .hui {
            width: 40%;
            height: 35px;
            color: white;
            background-color: red;
            border: red;
            border-radius: 8px;
            margin-top: 33px;
            position: absolute;
            left: 50%;
            margin-left: -70.5px;
        }
    </style>
</head>
<body>
<div id="content">
    <form name="addform" id="addform" method="post" action="message_handle.php" onSubmit="return beforeSubmit(this);">
        <span> 立即咨询获取方案和报价 </span>
        <div id="form_div">
                <input type="hidden" id="id" name="id" />
            <div>
                <span>你的姓名</span>
                <input type="text" name="author" id="author"/>
            </div>
            <div>
                <span>你的联系方式</span>
                <input type="text"  name="tel" id="tel" onkeyup="value=value.replace(/[^\d]/g,'')" maxlength=11/>
            </div>
        </div>
        <div id="form_xq">
            <span>你的需求</span>
            <input type="text" name="message" id="message"/>
        </div>
        <input type="submit" name="sumbit" class="hui" value="发送你的需求"/>
    </form>
</div>

<script type="text/javascript">
    function beforeSubmit(form){
        if(form.author.value==''){
            alert('用户名不能为空！');
            form.author.focus();
            return false;
        }
        if(form.tel.value==''){
            alert('电话不能为空！');
            form.tel.focus();
            return false;
        }
        if(form.message.value==''){
            alert('留言信息不能为空！');
            form.message.focus();
            return false;
        }
        return true;
    }
</script>
</body>
</html>
